/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aaron.platform.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author chenzhouhua
 */
@Entity
@Table(name = "fgys_contract_info")
@SequenceGenerator(name="FGYS_CONTACTINFO_GENERATOR", sequenceName="FGYS_CONTACTINFO_GENERATOR", allocationSize = 1)
@NamedQueries({
    @NamedQuery(name = "FgysContract.findAll", query = "SELECT f FROM FgysContract f")})
public class FgysContract implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="FGYS_CONTACTINFO_GENERATOR")
    @Column(name = "ctc_id")
    private Integer ctcId;

    /** 合同号 */
    @Column(name = "ctc_no")
    private String ctcNo;

    /** 合同名 */
    @Column(name = "ctc_name")
    private String ctcName;

    /** 合同价 */
    @Column(name = "ctc_amount")
    private float ctcAmount;

    /** 合同类型:1-室内分布集成费;2-直放站集成费;3-前期施工费;4-桥架建设费;5-电力工程款;6-征地费;7-其他 */
    @Column(name = "ctc_type")
    private int ctcType;

    /** 站点需求(二进制表示):001-GSM;010-TD;100-WLAN;000-其他
    *   如：011-含GSM和TD集成费用，没有WLAN覆盖费用
    */
    //@Column(name = "site_require")
    //private int siteRequire;

    /** 合同状态:1- 审批中;2-待签订;3-履行中;4-已结束 */
    @Column(name = "ctc_status")
    private int ctcStatus;

    /** 合同对应的订单列表 */
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ctcInfo", fetch = FetchType.LAZY)
    private List<FgysOrderInfo> fgysOrderInfoList;

    /** 合同对应的单位信息 */
    @JoinColumn(name = "enterprise_id", referencedColumnName = "enterprise_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysEnterprise enterpriseInfo;

    /** 合同所属的项目信息 */
    @JoinColumn(name = "project_id", referencedColumnName = "project_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysProject projectInfo;

    public FgysContract() {
    }

    public FgysContract(Integer ctcId) {
        this.ctcId = ctcId;
    }

    public Integer getCtcId() {
        return ctcId;
    }

    public void setCtcId(Integer ctcId) {
        this.ctcId = ctcId;
    }

    public String getCtcNo() {
        return ctcNo;
    }

    public void setCtcNo(String ctcNo) {
        this.ctcNo = ctcNo;
    }

    public String getCtcName() {
        return ctcName;
    }

    public void setCtcName(String ctcName) {
        this.ctcName = ctcName;
    }

    public float getCtcAmount() {
        return ctcAmount;
    }

    public void setCtcAmount(float ctcAmount) {
        this.ctcAmount = ctcAmount;
    }

    public int getCtcType() {
        return ctcType;
    }

    public void setCtcType(int ctcType) {
        this.ctcType = ctcType;
    }

    public int getCtcStatus() {
        return ctcStatus;
    }

    public void setCtcStatus(int ctcStatus) {
        this.ctcStatus = ctcStatus;
    }

    public List<FgysOrderInfo> getFgysOrderInfoList() {
        return fgysOrderInfoList;
    }

    public void setFgysOrderInfoList(List<FgysOrderInfo> fgysOrderInfoList) {
        this.fgysOrderInfoList = fgysOrderInfoList;
    }

    public FgysEnterprise getEnterpriseInfo() {
        return enterpriseInfo;
    }

    public void setEnterpriseInfo(FgysEnterprise enterpriseInfo) {
        this.enterpriseInfo = enterpriseInfo;
    }

    public FgysProject getProjectInfo() {
        return projectInfo;
    }

    public void setProjectInfo(FgysProject projectInfo) {
        this.projectInfo = projectInfo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ctcId != null ? ctcId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FgysContract)) {
            return false;
        }
        FgysContract other = (FgysContract) object;
        if ((this.ctcId == null && other.ctcId != null) || (this.ctcId != null && !this.ctcId.equals(other.ctcId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aaron.platform.entity.FgysContract[ctcId=" + ctcId + "]";
    }
}
